﻿
@{
    ViewData["Title"] = "忘记密码";
    Layout = "~/Areas/WX/Views/Shared/_Layout.cshtml";
}

<header class="hui-header">
    <div id="hui-back" onclick="gotoHome()"></div>
    <h1>忘记密码</h1>
</header>
<form class="hui-wrap" id="form1" method="post">
    <div class="hui-center-title" style="margin-top:35px;"><h1 style="border:0px;">输入验证信息</h1></div>
    <div style="margin:20px 10px; margin-bottom:15px;" class="hui-form" id="form1">
        <div class="hui-form-items">
            <div class="hui-form-items-title">登录账号</div>
            <input type="text" class="hui-input hui-input-clear" name="username" placeholder="请输入登录账号" checkType="string" />
        </div>
        <div class="hui-form-items">
            <div class="hui-form-items-title">姓名</div>
            <input type="text" class="hui-input hui-input-clear" name="name" placeholder="请输入您的姓名" checkType="name" />
        </div>

    </div>
    <div style="padding:10px; padding-top:10px;">
        <button type="button" class="hui-button hui-button-large hui-primary" id="submit">验证信息</button>
    </div>
</form>

@section Scripts{
    <script src="~/HUI-master/js/hui-form.js"></script>
    <script>
        function gotoHome() {
            window.location.href = '/Mobile/Account/Login'
        }
        hui('#submit').click(function () {
            var data = hui.getFormData('#form1');
            console.log(data)
           hui.post(
                    '/WX/Account/ForgotPassword',
                    data,
                    function (msg) {
                        if (msg == 'ok') {
                            localStorage.setItem('username', data.username);
                            hui.alert('信息验证成功', '好的', function () { window.location.href = '/WX/Account/ChangePassword' });
                        } else {
                            hui.alert('信息验证失败', '修改', function () {  });
                        }
                    },
                    function (e) {
                        hui.iconToast('读取消息失败', 'warn');
                    }
                );

        });
    </script>
}

